var api = require("@/common/api.js");

export default {
	data() {
		return {
			warehouseList: [],
			treeCatList: [],
			calssList: [],
			productList: [],
			infoData: ''
		};
	},
	created() {

	},
	methods: {
		// 获取仓库列表
		getWarehouse(callBreak, id = null) {
			this.api.get('warehouse', {
				follow_user: id
			}).then(res => {
				this.warehouseList = res.data
				callBreak()
			})
		},
		// 获取产品分类
		getCat(callBreak) {
			this.api.get('get_tree_cat', {
				cat_id: 0
			}).then(res => {
				this.treeCatList = res.data
				callBreak()

			})
		},
		// 获取班组
		getCalss(callBreak) {
			this.api.get('calss', {
				cat_id: 0
			}).then(res => {
				this.calssList = res.data
				callBreak()

			})
		},
		getProduct(query, callBreak) {
			const obj = {
				wId: query.wId,
				cat_id: query.cat_id,
				keyword: query.keyword,
				page: query.page ? query.size : 1,
				size: query.size ? query.size : 20
			}
			this.api.get('goods', obj).then(res => {
				this.productList = res.data.list
				callBreak()
			})
		},
	},
};